<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>修改用户</title>
<link href="__PUBLIC__/admin/css/xc.min.css" rel="stylesheet" type="text/css" />
<link href="__PUBLIC__/admin/css/xc.admin.css" rel="stylesheet" type="text/css" />
<link href="__PUBLIC__/lib/iconfont/iconfont.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="__PUBLIC__/admin/js/jquery.min.js"></script>
<script type="text/javascript" src="__PUBLIC__/admin/js/common-1.0.js"></script>
<script type="text/javascript" src="__PUBLIC__/lib/layer/layer.js"></script>
<script type="text/javascript" src="__PUBLIC__/admin/js/xc.js"></script> 
<script type="text/javascript" src="__PUBLIC__/admin/js/xc.admin.js"></script>

</head>
<body>
<div class="pd-5">
  <form action="#" method="post" class="form form-horizontal" id="myform">
    <div class="row cl">
      <label class="form-label col-3"><span class="c-red">*</span>会员编号：</label>
      <div class="formControls col-5" style="margin-top:3px;">{$re.us_uid}</div>
    </div>
    <div class="row cl">
      <label class="form-label col-3"><span class="c-red">*</span>直推会员：</label>
      <div class="formControls col-5">
        <if condition='($re.us_pid neq 0)'>
					<div class="formControls col-5" style="margin-top:3px;">{$re.us_pid}</div>
        <else />无</if>
      </div>
    </div>
    <div class="row cl">
      <label class="form-label col-3"><span class="c-red">*</span>会员姓名：</label>
			<div class="formControls col-5" style="margin-top:3px;">{$re.us_name}</div>
    </div>
    <div class="row cl">
      <label class="form-label col-3"><span class="c-red">*</span>手机号：</label>
			<div class="formControls col-5" style="margin-top:3px;">{$re.us_phone}</div>
    </div>
    <div class="row cl">
      <label class="form-label col-3"><span class="c-red">*</span>会员当前等级：</label>
			<div class="formControls col-5" style="margin-top:3px;">{$re.gr_name}</div>
    </div>
		<div class="row cl">
			<label class="form-label col-3"><span class="c-red">*</span>修改后会员等级：</label>
			<select class="select" size="1" id="grades" name="grades" style="width: 200px">
				<option value="0">请选择会员等级</option>
				<foreach name='grade' item='vo' key='k'>
					<option value="{$vo.gr_id}">{$vo.gr_name}</option>
				</foreach>
			</select>
		</div>
    <input type="hidden" id="uid" name="uid" value="{$re.us_uid}">
    <div class="row cl">
      <div class="col-9 col-offset-3">
        <button type="button" id="sub" name="sub" class="btn btn-primary radius" onClick="checkSubmit()"><i class='Hui-iconfont'>&#xe632;</i> 保存</button>
        <button class="btn btn-default radius" type="button" onClick="layer_close();"><i class='Hui-iconfont'>&#xe66b;</i> 取消</button>
      </div>
    </div>
  </form>
</div>
<script type="text/javascript">
//按回车件触发提交
document.onkeydown=function(event){
	var e = event || window.event || arguments.callee.caller.arguments[0];
	if(e && e.keyCode==13){ // enter 键
		checkSubmit();
	}
};
//提交数据
function checkSubmit()
{
	$.ajax({
		type : 'post',
		url : '__MODULE__/User/demotion',
		data : $("#myform").serialize(),
		dataType : 'json',
		success : function(res){
			if(res.status == 1){
				layer.msg(res.msg,{icon:1,time:2000},function(){
					// 先获取窗口索引，才能关闭窗口
					var index = parent.layer.getFrameIndex(window.name);
					parent.layer.close(index);
				});
				parent.call_back_fun('success');
			}else{
				layer.msg(res.msg, {icon: 2});
			}
		},
		error : function(XMLHttpRequest, textStatus, errorThrown) {
			layer.alert('网络失败，请刷新页面后重试',{icon:2});
		}
	})
}
</script>
</body>
</html>